﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QueueSimulator
{
    public class Random
    {
        private double m_modulus = Math.Pow(2,32);
        private double m_multiplier = 22695477;
        private double m_increment = 1;

        private double m_seed;

        public Random() : this(DateTime.Now.Ticks/DateTime.Now.Millisecond) { }

        public Random(double seed)
        {
            m_seed = seed;
        }

        public double Next()
        {
            m_seed = (m_multiplier * m_seed + m_increment) % m_modulus;
            return m_seed / m_modulus;
        }

        public double Next(double min, double max)
        {
            return min + ((max - min) * Next());
        }
    }
}
